package com.enhe.gck.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import com.enhe.gck.CarbonRelationType;
import com.kuangkie.carbon.record.Updatable;
import com.kuangkie.carbon.record.annotation.Attribute;
import com.kuangkie.carbon.record.annotation.CarbonRecord;
import com.kuangkie.carbon.record.annotation.RecordCode;
import com.kuangkie.carbon.record.annotation.Relation;
import com.kuangkie.carbon.uid.model.UidManager;
import lombok.Data;

import java.time.LocalDateTime;

// 编织袋记录
@CarbonRecord("hwane21270")
@Data
public class WovenBagRecord implements Updatable {
    @JSONField(name = "唯一编码")
    @RecordCode
    private Long id = UidManager.getLongUID();

    // 数量
    @JSONField(name = "数量")
    @Attribute("hwan21272")
    private Integer number;

    // 确认
    @JSONField(name = "确认")
    @Attribute("hwan21273")
    private Boolean isConfirm;

    // 类型
    @JSONField(name = "类型")
    @Attribute("hwan21275")
    private String type;

    // 备注
    @JSONField(name = "备注")
    @Attribute("hwan21276")
    private String remark;

    @JSONField(name = "确认时间")
    @Attribute("hwan21323")
    private LocalDateTime confirmTime;

    @JSONField(name = "作废")
    @Attribute("hwan21425")
    private Boolean isCancel;

    @Relation(value = CarbonRelationType.RR_编织袋记录_名称_编织袋管理, optType = "写")
    private Long wovenBagId;
    @Relation(value = CarbonRelationType.RR_编织袋记录_名称_编织袋管理, optType = "读")
    private WovenBag wovenBag;

    @Relation(CarbonRelationType.RR_编织袋记录_编织袋记录所属订单记录_订单记录)
    private Long orderId;

    @Override
    public String getRecordCode() {
        return this.id == null ? null : this.id.toString();
    }
}